package com.quanyan.place.mapper;

import com.quanyan.place.entity.*;
import com.quanyan.place.entity.apireq.*;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * Created by yuanxuebing on 16/12/14.
 */
public interface VPlacePromotionMapper {
    List<Integer> selectDistinctPlaceIds();


    List<PromoteOrder> getPlacePromoteOrders(@Param("reqVo")ReqPromoteOrders reqVo);

    PromoteStatInfo getPlacePromoteStat(@Param("reqVo")ReqPromoteOrders reqVo);

    // 管理后台获取推广记录
    List<PromoteResultInfo> getPlacePromotion(@Param("reqVo")ReqPromotionByAdmin reqVo);

    PromoteStatInfo getPlacePromotionStat(@Param("reqVo")ReqPromotionByAdmin reqVo);

    // 增加推广次数,并返回增加后的推广次数
    Integer increasePromotionTimes(@Param("mobile")String mobile);


    // 获取指定周期内订单奖励
    List<PromoteReward> getPromoteRewards(@Param("reqVo") ReqPromoteRewards reqVo);

    // 获取奖励订单汇总信息
    PromoteRewardStatInfo getPromoteRewardStat(@Param("reqVo")ReqPromoteRewards reqVo);

    //  获取提现(结算)记录
    List<PromoteWithdrawals> getPromoteWithdrawals(@Param("reqVo") ReqPromoteWithdrawals reqVo);

    // 获取提现(结算)记录汇总信息
    PromoteWithdrawalsStatInfo getPromoteWithdrawalsStatInfo(@Param("reqVo")ReqPromoteWithdrawals reqVo);

    // 获取在指定时间段内有推广行为的奖励候选人
    List<PromoteRewardSettleCandidate> getRewardCandidates(@Param("start")Date start, @Param("end")Date end);

    // 对账候选人
    List<ReconciliationCandidate> getReconciliationCandidates(@Param("reqVo") ReqPromoteReconciliation reqVo);

    // 获取奖励汇总
    List<PromoteReconciliation> getRewardReconciliation(@Param("uids") List<Integer> uids,
                                                        @Param("start")Date start, @Param("end")Date end);

    // 获取提现对账信息
    List<PromoteReconciliation> getStatmentReconciliation(@Param("uids") List<Integer> uids,
                                                          @Param("start")String start, @Param("end")String end);

    // 获取指定周期内奖励订单
    List<PromoteOrder> getRewardPromoteOrders(@Param("candidate")PromoteRewardSettleCandidate candidate);


    // 插入提现结算明细
    Integer insertRewardStatementDetails(@Param("statementId")Integer statementId, @Param("orders") List<PromoteOrder> orders);

    // 批量更新推广订单表中订单的奖励结算状态
    Integer batchUpdateOrderRewardSettleStatus(@Param("orders") List<PromoteOrder> orders, @Param("status")Integer status);
}
